// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) UXBOX Labs SL

.workspace-header {
  position: relative;
  align-items: center;
  background-color: $color-gray-50;
  border-bottom: 1px solid $color-gray-60;
  display: flex;
  padding: $size-1 $size-4 $size-1 55px;
  justify-content: space-between;

  display: grid;
  grid-template-areas: "left center right";
  grid-template-columns: auto 1fr auto;
  grid-template-rows: 100%;
  padding: 0;

  .left-area {
    grid-area: left;
    display: flex;
    height: 100%;
  }

  .center-area {
    grid-area: center;
  }

  .right-area {
    grid-area: right;
    display: flex;
    height: 100%;
  }

  .main-icon {
    align-items: center;
    background-color: $color-gray-60;
    border-bottom: 1px solid $color-gray-50;
    cursor: pointer;
    display: flex;
    height: 100%;
    justify-content: center;
    width: 48px;

    a {
      height: 30px;

      svg {
        fill: $color-gray-30;
        height: 30px;
        width: 28px;
      }

      &:hover {
        svg {
          fill: $color-primary;
        }
      }
    }
  }

  .menu-section {
    margin-left: 1rem;
    display: flex;
    justify-content: flex-start;
    align-items: center;
  }

  .shared-badge {
    margin-left: $size-1;
    height: 16px;
    width: 16px;
    display: flex;
    align-items: center;
    justify-content: center;

    svg {
      fill: $color-gray-20;
      height: 12px;
      width: 12px;
    }
  }

  .users-section {
    display: flex;
  }

  .options-section {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    position: relative;
    padding-right: 1rem;
    border-right: 1px solid black;

    > * {
      margin-left: $size-5;
    }

    .zoom-dropdown {
      top: 45px;
      left: 98px;
    }
  }

  .project-tree {
    align-items: center;
    display: flex;
    margin-left: $size-1;
    padding: $size-1;

    svg {
      fill: $color-gray-20;
      height: 20px;
      margin-right: $size-2;
      width: 20px;
    }

    span {
      color: $color-white;
      font-size: $fs14;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;

      &.project-name {
        color: $color-gray-20;
        margin-right: $size-1;
        cursor: pointer;

        &:hover {
          color: $color-primary;
        }
      }
    }

    .file-name {
      margin: 0;
      padding: 0;
      border: none;
      border-bottom: 1px solid $color-gray-10;
      background: $color-gray-50;
      color: $color-gray-10;
      margin-bottom: -1px;
    }
  }

  .menu {
    position: absolute;
    top: 40px;
    left: 40px;
    width: 195px;
    z-index: 12;

    background-color: $color-white;
    border-radius: $br-small;
    box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.25);

    :first-child {
      &:hover {
        border-radius: $br-small $br-small 0px 0px;
      }
    }
    :last-child {
      &:hover {
        border-radius: 0px 0px $br-small $br-small;
      }
    }

    li {
      cursor: pointer;
      font-size: $fs14;
      padding: $size-2;
      display: flex;
      justify-content: space-between;

      svg {
        fill: $color-gray-60;
        height: 12px;
        width: 12px;
      }

      span {
        color: $color-gray-60;
        margin: 0 $size-1;
      }

      &:hover {
        background-color: $color-primary-lighter;
      }

      &.info {
        border-top: 1px solid $color-gray-10;
      }
    }
  }

  .sub-menu {
    position: absolute;
    left: 238px;
    width: 270px;
    z-index: 12;
    background-color: $color-white;
    border-radius: $br-small;
    box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.25);

    :first-child {
      &:hover {
        border-radius: $br-small $br-small 0px 0px;
      }
    }
    :last-child {
      &:hover {
        border-radius: 0px 0px $br-small $br-small;
      }
    }

    &.file {
      top: 40px;
    }

    &.edit {
      top: 77px;
    }

    &.view {
      top: 114px;
    }

    &.preferences {
      top: 150px;
    }

    &.help-info {
      top: 186px;
    }

    li {
      cursor: pointer;
      font-size: $fs14;
      padding: $size-2;
      display: flex;
      justify-content: space-between;

      span {
        color: $color-gray-60;
        margin: 0 $size-1;
      }

      .shortcut {
        color: $color-gray-20;
        font-size: $fs12;
      }

      &:hover {
        background-color: $color-primary-lighter;
      }

      &.separator {
        border-top: 1px solid $color-gray-10;
      }
    }
  }

  .active-users {
    flex: 1;
    justify-content: center;
    display: flex;
    margin: 0;

    li {
      margin-left: $size-2;
      position: relative;

      img {
        border: 3px solid #f3dd14;
        border-radius: 50%;
        flex-shrink: 0;
        height: 25px;
        width: 25px;
      }
    }
  }

  & button.document-history {
    background: $color-gray-60;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    height: 24px;
    padding: 3px;
    width: 24px;

    & svg {
      width: 18px;
      fill: $color-gray-20;
      height: 18px;
    }

    &.selected svg {
      fill: $color-primary;
    }
  }
}

.export-progress-widget {
  cursor: pointer;
  padding-top: 6px;
}

.persistence-status-widget {
  display: flex;
  margin-left: 0px;
  margin-right: 10px;
  /* border: 1px solid red; */
  width: 150px;
  justify-content: flex-end;

  > div {
    display: flex;

    &.error {
      .label {
        color: $color-danger;
      }
      .icon svg {
        fill: $color-danger;
      }
    }

    &.pending {
      .label {
        color: $color-warning;
      }
      .icon svg {
        fill: $color-warning;
      }
    }
  }

  .icon {
    padding: 0px 10px;
  }

  .label {
    color: $color-gray-30;
    font-size: $fs14;
  }

  svg {
    width: 12px;
    height: 12px;
    fill: $color-gray-30;
  }
}
